package edu.uhcl.team_drone.game;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.math.Vector3;
import edu.uhcl.team_drone.assets.Assets;
import edu.uhcl.team_drone.screens.SplashScreen;

//"Main" method of the prototype 
public class ProjectGame extends Game {
    public static PerspectiveCamera cam; // 3D camera
    public static ModelBatch modelBatch; // used to render the instance
    
    private boolean loading = false;

    @Override
    public void create() {
        Assets.init();
        loading = true;
        
        // make 3d batch for rendering
        modelBatch = new ModelBatch();

        // make the camera.
        // params 67 = viewportwidth in degrees, a usual number for FPS
        cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        cam.near = 1f;
        cam.far = 15000f;

        cam.lookAt(Vector3.Zero);
        cam.update(true);

    }

    private void doneLoading() {
        loading = false;
        setScreen(new SplashScreen(this));
    }

    @Override
    public void render() {
        if (loading && Assets.manager.update()) {
            doneLoading();
        }
        super.render();
    }

    @Override
    public void dispose() {}
}
